package com.bfg.model;

import java.util.Vector;
import java.util.Set;
import java.util.HashMap;
import java.util.ResourceBundle;

/**
 * Implements categories, which are collections of products.
 *
 * Copyright 2002, James M. Turner
 * No warranty is made as to the fitness of this code for any
 * particular purpose.  It is included for demonstration purposes
 * only.
 *
 * @author       James M. Turner
 */

public class Category {
    private static ResourceBundle sql_bundle =
	ResourceBundle.getBundle("com.bfg.model.SQLQueries");

    protected int pID;
    protected Product pFeaturedProduct;
    protected Vector pProducts = new Vector();
    protected String pName;
    protected static HashMap categories = new HashMap();

    /**
     * Returns the unique category ID
     *
     * @return the category ID
     **/

    public int getID() {
	return pID;
    }

    private void setID(int ID) {
	pID = ID;
    }

    /**
     * Returns the category name
     *
     * @return the category name
     **/

    public String getName() {
	return pName;
    }

    private void setName(String Name) {
	pName = Name;
    }

    /**
     * Returns the product which should be featured in a display page for this 
     * category.
     *
     * @return The featured product
     **/

    public Product getFeaturedProduct() {
	return pFeaturedProduct;
    }

    private void setFeaturedProduct(Product Product) {
	pFeaturedProduct = Product;
    }

    /**
     * Returns a vector containing all the products in this category.
     *
     * @return The products in a Vector
     **/

    public Vector getProducts() {
	return pProducts;
    }

    private void setProducts(Vector Products) {
	pProducts = Products;
    }

    /**
     * Returns the categories as a Set
     *
     * @return The categories
     **/

    public static Set getCategories() {
	return categories.keySet();
    }

}	

